package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.bean.SellCarBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ISellCarMapper extends BaseMapper<SellCarBean> {
    @Select("SELECT SUM(tp.`p_sellMoney`*ts.`sc_num`) FROM t_sellCar ts,t_product tp WHERE " +
            "ts.`fk_productId`= tp.`pk_productId` AND ts.`fk_userId` = #{userId}")
    @ResultType(Integer.class)
    Integer getSellMoney(Integer userId);

    List<SellCarBean> findUserId(Integer userId);
}
